#define DEBUG
#include <cstdio>

using namespace std;

template <typename T>
void swap(T &a, T &b) {
  T t;
  t=a, a=b, b=t;
}

class Splay {
public:
  Splay *son[2], *fa;
  bool mark;
  int key, size;

  Splay(int x, Splay *f=NULL) {
    key = x, size=1;
    mark = false;
    son[0] = son[1] = NULL, fa = f;
  }

  int getPos() {
    return fa ? (fa->son[0]==this ? 0 : 1) : -1;
  }

  static int getSize(Splay *a) {
    return a ? a->size : 0;
  }

  void update() {
    size = getSize(son[0]) + getSize(son[1])+1;
  }

  void markDown() {
    if (mark) {
      swap(son[0], son[1]);
      if (son[0]) {
	son[0]->mark ^= 1;
      }
      if (son[1]) {
	son[1]->mark ^= 1;
      }
      mark = false;
    }
  }

  void rotate() {
    if (!fa) {
      return;
    }
    int p=getPos();
    Splay *t=fa;
    if (t->fa) {
      t->fa->son[t->getPos()] = this;
      fa = t->fa;
    } else {
      fa = NULL;
    }
    t->son[p] = son[!p];
    if (son[!p]) {
      son[!p]->fa = t;
    }
    son[!p] = t;
    t->fa = this;
    t->update();
    update();
  }

  Splay* splay(Splay *tar=NULL) {
    for (; fa!=tar; ) {
      if (fa->fa!=tar && fa->getPos()==getPos()) {
	fa->rotate(), this->rotate();
      } else {
	rotate();
      }
    }
    return this;
  }

  Splay* find(int l, int r, int t) {
    markDown();
    if (getSize(son[0])+l-1>=t) {
      return son[0]->find(l, l+getSize(son[0])+1, t);
    } else if (l+getSize(son[0])==t) {
      return this;
    } else {
      return son[1]->find(l+getSize(son[0])+1, r, t);
    }
  }

  void print(int l, int r) {
    markDown();
    if (son[0]) {
      son[0]->print(l, r);
    }
    if (key>=l && key<=r) {
      printf("%d ", key);
    }
    if (son[1]) {
      son[1]->print(l, r);
    }
  }
};

int main() {
#ifdef DEBUG
  freopen("src.in", "r", stdin);
  freopen("src.out", "w", stdout);
#endif

  int n, m;
  scanf("%d %d", &n, &m);
  Splay *root = new Splay(0);
  for (int i=1; i<=n+1; i++) {
    root->son[1] = new Splay(i, root);
    root->size++;
    root = root->son[1]->splay();
  }

  for (int i=1; i<=m; i++) {
    int l, r;
    scanf("%d %d", &l, &r);
    root = root->find(0, n+1, l-1)->splay();
    root->son[1] = root->find(0, n+1, r+1)->splay(root);
    root->son[1]->son[0]->mark ^= 1;
  }

  root->print(1, n);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
